import urllib.parse
from urllib.request import *
from urllib.parse import *

# result=urlopen('https://fkjava.org/')
# data=result.read(326)
# print(data.decode('utf-8'))

params = urllib.parse.urlencode({'wd': '1'})
url = 'https://www.baidu.com/s?%s' % params

# req = Request(url='https://www.baidu.com/s?wd=1', method='get')
print(url)
with urlopen(url=url) as f:
    # 按字节读取数据
    data = f.read()
    # 将字节数据恢复成字符串
    print(data.decode('utf-8'))
